package com.baizhi.service.impl;

import com.baizhi.entity.CmfzLog;
import com.baizhi.mapper.CmfzLogMapper;
import com.baizhi.service.CmfzLogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CmfzLogServiceImpl implements CmfzLogService {
    @Autowired
    private CmfzLogMapper cmfzLogMapper;
    @Override
    public Page<CmfzLog> selectAll(Integer page, Integer limit, String type) {
        if (type==null){
            Page<CmfzLog> cmfzLogPage = cmfzLogMapper.selectPage(new Page<>(page, limit), null);
            return cmfzLogPage;
        }else {
            QueryWrapper<CmfzLog> queryWrapper = new QueryWrapper<>();
            queryWrapper.like("log_type",type);
            Page<CmfzLog> cmfzLogPage = cmfzLogMapper.selectPage(new Page<>(page, limit), queryWrapper);
            return cmfzLogPage;
        }
    }
}
